A typical Amiga application program reflects this message-passing structure, shown in the following pseudocode:
while (1) { mask = Wait(port); /* Wait for a message. Non-busy-wait. */ message = GetMessage(mask); /* What message arrived? */ class = message->class; /* Save important message info. */ Reply_To_Message(message); switch (class) { case MOUSE_MOVE: ... case WINDOW_RESIZE: ... case FILE_WAS_MODIFIED: ... case CONTROL_C_WAS_PRESSED: ... case USER_CHANGED_SYSTEM_COLORS: ... case MY_OWN_SPECIALLY_DEFINED_MESSAGE: ... ... } }
Many routine messages such as window resizings may be handled by the operating system rather than the application. See Section for more information.